<template>
	<div class="register" :height="fullHeight" :width="fullWidth">
		<div class="goods" ><!-- :style="backgroundDiv" -->
			<!-- <van-image width="100%" 
					   height="100%" 
					   fit="fill" 
					   :src="require('../../../public/images/background.jpg')"/> -->
		</div>
	</div>
</template>

<script>
export default {
  data() {
    return {
		fullWidth:document.documentElement.clientWidth,
		fullHeight:document.documentElement.clientHeight,
		backgroundDiv: {
			backgroundImage:'url(' + require('../../../public/images/background.jpg') + ')',
			backgroundRepeat:'no-repeat',
			backgroundSize:'100% 100%'
		},
      goods: {
        title: '美国伽力果（约680g/3个）',
        price: 2680,
        express: '免运费',
        remain: 19,
        thumb: [
          'https://img.yzcdn.cn/public_files/2017/10/24/e5a5a02309a41f9f5def56684808d9ae.jpeg',
          'https://img.yzcdn.cn/public_files/2017/10/24/1791ba14088f9c2be8c610d0a6cc0f93.jpeg'
        ]
      }
    };
  },
  created(){
          window.addEventListener('resize', this.handleResize)
      },
	  beforeDestroy: function () {
	          window.removeEventListener('resize', this.handleResize)
	      },
  methods: {
    formatPrice() {
      return '¥' + (this.goods.price / 100).toFixed(2);
    },
	handleResize (event) {
	            this.fullWidth = document.documentElement.clientWidth;
				this.fullHeight = document.documentElement.clientHeight;
	        },

    onClickCart() {
      this.$router.push('cart');
    },

    sorry() {
      Toast('暂无后续逻辑~');
    }
  }
};
</script>
<style lang="less">
	.goods{
		width: 100%;
		height: 100%;
		background-image: url(../../../public/images/background.jpg);
		background-attachment: fixed;
		background-size: cover; /* 使图片平铺满整个浏览器（从宽和高的最大需求方面来满足，会使某些部分无法显示在区域中） */
		position: absolute; /* 不可缺少 */
		/* overflow: hidden; */
		/* overflow: auto; */
		z-index: -1;
		background-repeat: no-repeat;
	}
	/* 注释部分要不要都一样 */
	img{
		position: fixed; /* 固定图片位置 */
	}
</style>
